﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookVoting
{
    public partial class Default2 : System.Web.UI.Page
    {
        protected string M_str_rate1;
        protected string M_str_rate2;
        protected string M_str_rate3;
        protected string M_str_rate4;
        protected void Page_Load(object sender, EventArgs e)
        {
            int P_int_count1 = count.readCount(Server.MapPath("count1.txt"));
            int P_int_count2 = count.readCount(Server.MapPath("count2.txt"));
            int P_int_count3 = count.readCount(Server.MapPath("count3.txt"));
            int P_int_count4 = count.readCount(Server.MapPath("count4.txt"));
            int P_int_count = P_int_count1 + P_int_count2 + P_int_count3 + P_int_count4;
            if (P_int_count == 0)
            {
                Response.Write("<script>alert('还没有人投过票！')</script>");
                Label1.Text = "0";
            }
            else
            {
                M_str_rate1 = Convert.ToString(P_int_count1 * 100 / P_int_count) + "%";
                M_str_rate2 = Convert.ToString(P_int_count2 * 100 / P_int_count) + "%";
                M_str_rate3 = Convert.ToString(P_int_count3 * 100 / P_int_count) + "%";
                M_str_rate4 = Convert.ToString(P_int_count4 * 100 / P_int_count) + "%";
                Label1.Text = P_int_count.ToString();
            }
        }
    }
}